﻿
using System.Windows;
using System.Windows.Media;
using YY.Admin.ViewModels.Control;
using YY.Admin.ViewModels.Dialogs;
using YY.Admin.Views;
using YY.Admin.Views.Control;
using YY.Admin.Views.Dialogs;
using YY.Admin.Views.SysManage;

namespace YY.Admin
{
    public static class NavigationExtensions
    {
        /// <summary>
        /// 注册导航
        /// </summary>
        public static void AddNavigation(this IContainerRegistry containerRegistry)
        {
            // 注册对话框
            containerRegistry.RegisterDialog<AlertDialogView, AlertDialogViewModel>("AlertDialog");
            containerRegistry.RegisterDialog<SuccessDialogView, SuccessDialogViewModel>("SuccessDialog");
            containerRegistry.RegisterDialog<ErrorDialogView, ErrorDialogViewModel>("ErrorDialog");
            containerRegistry.RegisterDialog<WarningDialogView, WarningDialogViewModel>("WarningDialog");
            containerRegistry.RegisterDialog<ConfirmDialogView, ConfirmDialogViewModel>("ConfirmDialog");

            // 设置对话框样式
            containerRegistry.RegisterDialogWindow<DialogWindow>();
            
            // 注册导航
            containerRegistry.RegisterForNavigation<DashboardView>("DashboardView");
            // 404视图
            containerRegistry.RegisterForNavigation<NotFoundView>("NotFoundView");
            //containerRegistry.RegisterForNavigation<RoleManagementView>("RoleManagementView");
            //containerRegistry.RegisterForNavigation<PermissionManagementView>("PermissionManagementView");
            //containerRegistry.RegisterForNavigation<OrderManagementView>("OrderManagementView");
            //containerRegistry.RegisterForNavigation<ProductManagementView>("ProductManagementView");
            //containerRegistry.RegisterForNavigation<ReportView>("ReportView");
            //containerRegistry.RegisterForNavigation<MonitorView>("MonitorView");

            // 窗口注册
            containerRegistry.Register<LoginWindow>();
            containerRegistry.Register<MainWindow>();

            // 注册视图（页面）
            containerRegistry.RegisterForNavigation<MenuTreeView>();
            containerRegistry.RegisterForNavigation<UserManagementView>();
            containerRegistry.RegisterForNavigation<RoleManagementView>();
     
        }
    }
    public class DialogWindow : Window, IDialogWindow
    {
        public DialogWindow()
        {
            WindowStyle = WindowStyle.None;
            AllowsTransparency = true;
            Background = Brushes.Transparent;         // 背景透明
            WindowStartupLocation = WindowStartupLocation.CenterOwner;
            SizeToContent = SizeToContent.WidthAndHeight;
            ResizeMode = ResizeMode.NoResize;
        }
        public IDialogResult? Result { get; set; }
    }
    //public class DialogWindow : Window, IDialogWindow
    //{
    //    public DialogWindow()
    //    {
    //        //InitializeComponent();

    //        // 去掉最大化最小化
    //        ResizeMode = ResizeMode.NoResize;

    //        // 去掉右上角系统按钮
    //        WindowStyle = WindowStyle.None;
    //    }
    //    public IDialogResult Result { get; set; }
    //}
}
